/*	Problem: http://codeforces.ru/problemset/problem/100/E
	  Verdict: Accepted
*/
int main() {
        int n;
        string ns = Stdio.stdin->gets();
        sscanf(ns, "%d", n);
        
        string ss = Stdio.stdin->gets();
        ss = replace(ss, "on", "1");
        ss = replace(ss, "off", "0");
        array(array(int)) s;
        sscanf(ss, "%{%d%}", s);
        
        int k;
        string ks = Stdio.stdin->gets();
        sscanf(ks, "%d", k);
        
        string cs = Stdio.stdin->gets();
        array(array(int)) c;
        sscanf(cs, "%{%d%}", c);
        
        array(int) state = allocate(n);
        
        array(int) count = allocate(n + 1);
        for (int i = 0; i < k; i++)
                count[c[i][0]]++;
        
        for (int i = 1; i <= n; i++) {
                if (count[i] % 2 == 0)
                        continue;
                for (int j = i - 1; j < n; j += i)
                        state[j] = 1 - state[j];
        }
        
        for (int i = 0; i < n; i++) {
                if (i > 0)
                        write(" ");
                int cur = s[i][0];
                if (state[i])
                        cur = 1 - cur;
                if (cur == 0) {
                        write("off");
                } else {
                        write("on");
                }
        }
        write("\n");
        
        return 0;
}